/*MyPhotoIndex Free Photo Organizer <www.myphotoindex.com>
  Copyright (C) <2006-2009>  <Asaf Yarkoni asaf@yarkoni.net>

  This program is free software: you can redistribute it and/or modify
  it under the terms of the GNU General Public License as published by
  the Free Software Foundation, either version 3 of the License, or
  (at your option) any later version.

  This program is distributed in the hope that it will be useful,
  but WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  GNU General Public License for more details.

  You should have received a copy of the GNU General Public License
  along with this program.  If not, see <http://www.gnu.org/licenses/>.*/
using System;
using System.Collections.Generic;
using System.Text;
using MyPhotoIndex.Interfaces;
using System.ComponentModel;

namespace MyPhotoIndex.Plugins
{
    public class WebHostPluginSettings : IDynamicSetting
    {
        private static ISettingsManager m_settingsManager;

        private bool m_useWebInterface;
        private int m_port;
        private bool m_openFirewallPort = true;
        private bool m_openNATPortForwarding = true;
        private bool m_useAuthentication;
        private string m_userName;
        private string m_password;

        public WebHostPluginSettings()
        {
            m_useWebInterface = false;
            m_port = 8082;
        }

        public override string ToString()
        {
            return "Web Interface";
        }

        public static WebHostPluginSettings Default
        {
            get
            {
                return (WebHostPluginSettings)SettingsManager[typeof(WebHostPluginSettings)];
            }
        }

        public static ISettingsManager SettingsManager
        {
            get { return WebHostPluginSettings.m_settingsManager; }
            set { WebHostPluginSettings.m_settingsManager = value; }
        }

        [Category("Web Interface")]
        [DisplayName("Please use the Tools menu for configuring this plugin")]
        [Browsable(false)]
        public bool UseWebInterface
        {
            get { return m_useWebInterface; }
            set { m_useWebInterface = value; }
        }

        [Category("Web Interface")]
        [Browsable(false)]
        public int Port
        {
            get { return m_port; }
            set { m_port = value; }
        }

        [Category("Web Interface")]
        [Browsable(false)]
        public bool UseAuthentication
        {
            get { return m_useAuthentication; }
            set { m_useAuthentication = value; }
        }

        [Category("Web Interface")]
        [Browsable(false)]
        public string UserName
        {
            get { return m_userName; }
            set { m_userName = value; }
        }

        [Category("Web Interface")]
        [Browsable(false)]
        public string Password
        {
            get { return m_password; }
            set { m_password = value; }
        }

        [Category("Web Interface")]
        [Browsable(false)]
        public bool OpenFirewallPort
        {
            get { return m_openFirewallPort; }
            set { m_openFirewallPort = value; }
        }

        [Category("Web Interface")]
        [Browsable(false)]
        public bool OpenNATPortForwarding
        {
            get { return m_openNATPortForwarding; }
            set { m_openNATPortForwarding = value; }
        }

        internal void Save()
        {
            SettingsManager.Save();
        }
    }
}
